package com.xrkj.miniprogram.client.controller;

import java.util.HashMap;
import java.util.Map;

import core.Data;
import core.data.DataResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import com.xrkj.miniprogram.client.service.RegisterRequestService;
import com.xrkj.miniprogram.server.entity.vo.RegistrationRequestVO;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RegisterRequestController {
	@Autowired
	RegisterRequestService service;
	
	//用户请求注册
	@RequestMapping("/registerRequest")
	public DataResult registerRequest(@RequestParam Map<String,Object> map) {
		return Data.create(map).<RegistrationRequestVO>addHandle("Validate",data->{
			new RegistrationRequestVO().validate(new String[]{
					"*wxOpenid","*nickname","groupName","position","reason"
			}).check(data);
		}).addHandle("register",data->{
			service.register(data);
		}).start().getResult();

	}

}
